<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP, DeriveDataTypeable, UnboxedTuples #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# OPTIONS_HADDOCK not-home #-}</span><span>
</span><span id="line-3"></span><span>
</span><span id="line-4"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-5"></span><span class="hs-comment">-- Module      : Data.Text.Internal</span><span>
</span><span id="line-6"></span><span class="hs-comment">-- Copyright   : (c) 2008, 2009 Tom Harper,</span><span>
</span><span id="line-7"></span><span class="hs-comment">--               (c) 2009, 2010 Bryan O'Sullivan,</span><span>
</span><span id="line-8"></span><span class="hs-comment">--               (c) 2009 Duncan Coutts</span><span>
</span><span id="line-9"></span><span class="hs-comment">--</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- License     : BSD-style</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- Maintainer  : bos@serpentine.com</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- Stability   : experimental</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- Portability : GHC</span><span>
</span><span id="line-14"></span><span class="hs-comment">--</span><span>
</span><span id="line-15"></span><span class="hs-comment">-- A module containing private 'Text' internals. This exposes the</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- 'Text' representation and low level construction functions.</span><span>
</span><span id="line-17"></span><span class="hs-comment">-- Modules which extend the 'Text' system may need to use this module.</span><span>
</span><span id="line-18"></span><span class="hs-comment">--</span><span>
</span><span id="line-19"></span><span class="hs-comment">-- You should not use this module unless you are determined to monkey</span><span>
</span><span id="line-20"></span><span class="hs-comment">-- with the internals, as the functions here do just about nothing to</span><span>
</span><span id="line-21"></span><span class="hs-comment">-- preserve data invariants.  You have been warned!</span><span>
</span><span id="line-22"></span><span>
</span><span id="line-23"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Data.Text.Internal</span><span>
</span><span id="line-24"></span><span>    </span><span class="hs-special">(</span><span>
</span><span id="line-25"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Types</span></span><span>
</span><span id="line-26"></span><span>    </span><span class="annot"><span class="hs-comment">-- $internals</span></span><span>
</span><span id="line-27"></span><span>      </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier">Text</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-28"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Construction</span></span><span>
</span><span id="line-29"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#text"><span class="hs-identifier">text</span></a></span><span>
</span><span id="line-30"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#textP"><span class="hs-identifier">textP</span></a></span><span>
</span><span id="line-31"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Safety</span></span><span>
</span><span id="line-32"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#safe"><span class="hs-keyword">safe</span></a></span><span>
</span><span id="line-33"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Code that must be here for accessibility</span></span><span>
</span><span id="line-34"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#empty"><span class="hs-identifier">empty</span></a></span><span>
</span><span id="line-35"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#empty_"><span class="hs-identifier">empty_</span></a></span><span>
</span><span id="line-36"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Utilities</span></span><span>
</span><span id="line-37"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#firstf"><span class="hs-identifier">firstf</span></a></span><span>
</span><span id="line-38"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Checked multiplication</span></span><span>
</span><span id="line-39"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#mul"><span class="hs-identifier">mul</span></a></span><span>
</span><span id="line-40"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#mul32"><span class="hs-identifier">mul32</span></a></span><span>
</span><span id="line-41"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#mul64"><span class="hs-identifier">mul64</span></a></span><span>
</span><span id="line-42"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Debugging</span></span><span>
</span><span id="line-43"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#showText"><span class="hs-identifier">showText</span></a></span><span>
</span><span id="line-44"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">

#if defined(ASSERTS)
</span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Control.Exception</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">assert</span><span class="hs-special">)</span><span>
</span><span id="line-48"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">GHC.Stack</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">HasCallStack</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Bits.html#"><span class="hs-identifier">Data.Bits</span></a></span><span>
</span><span id="line-51"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Int.html#"><span class="hs-identifier">Data.Int</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Int.html#Int32"><span class="hs-identifier">Int32</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier">Int64</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-52"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Text.Internal.Unsafe.Char.html"><span class="hs-identifier">Data.Text.Internal.Unsafe.Char</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.Unsafe.Char.html#ord"><span class="hs-identifier">ord</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-53"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Typeable.html#"><span class="hs-identifier">Data.Typeable</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Typeable.Internal.html#Typeable"><span class="hs-identifier">Typeable</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-54"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.Text.Array.html"><span class="hs-identifier">Data.Text.Array</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">A</span></span><span>
</span><span id="line-55"></span><span>
</span><span id="line-56"></span><span class="hs-comment">-- | A space efficient, packed, unboxed Unicode text type.</span><span>
</span><span id="line-57"></span><span class="hs-keyword">data</span><span> </span><span id="Text"><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-var">Text</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="Text"><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-var">Text</span></a></span></span><span>
</span><span id="line-58"></span><span>    </span><span class="hs-pragma">{-# UNPACK</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="Data.Text.Array.html#Array"><span class="hs-identifier hs-type">A.Array</span></a></span><span>          </span><span class="hs-comment">-- payload (Word16 elements)</span><span>
</span><span id="line-59"></span><span>    </span><span class="hs-pragma">{-# UNPACK</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>              </span><span class="hs-comment">-- offset (units of Word16, not Char)</span><span>
</span><span id="line-60"></span><span>    </span><span class="hs-pragma">{-# UNPACK</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>              </span><span class="hs-comment">-- length (units of Word16, not Char)</span><span>
</span><span id="line-61"></span><span>    </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Typeable.Internal.html#Typeable"><span class="hs-identifier hs-type">Typeable</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-62"></span><span>
</span><span id="line-63"></span><span class="hs-comment">-- | Smart constructor.</span><span>
</span><span id="line-64"></span><span class="annot"><a href="Data.Text.Internal.html#text_"><span class="hs-identifier hs-type">text_</span></a></span><span> </span><span class="hs-glyph">::</span><span class="hs-cpp">
#if defined(ASSERTS)
</span><span>  </span><span class="hs-identifier">HasCallStack</span><span> </span><span class="hs-glyph">=&gt;</span><span class="hs-cpp">
#endif
</span><span>  </span><span class="annot"><a href="Data.Text.Array.html#Array"><span class="hs-identifier hs-type">A.Array</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-69"></span><span id="text_"><span class="annot"><span class="annottext">text_ :: Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text_"><span class="hs-identifier hs-var hs-var">text_</span></a></span></span><span> </span><span id="local-6989586621679105111"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679105111"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679105110"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679105110"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679105109"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679105109"><span class="hs-identifier hs-var">len</span></a></span></span><span> </span><span class="hs-glyph">=</span><span class="hs-cpp">
#if defined(ASSERTS)
</span><span>  </span><span class="hs-keyword">let</span><span> </span><span class="hs-identifier">c</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">A.unsafeIndex</span><span> </span><span class="hs-identifier">arr</span><span> </span><span class="hs-identifier">off</span><span>
</span><span id="line-72"></span><span>  </span><span class="hs-keyword">in</span><span> </span><span class="hs-identifier">assert</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">len</span><span> </span><span class="hs-operator">&gt;=</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span> </span><span class="hs-operator">.</span><span>
</span><span id="line-73"></span><span>     </span><span class="hs-identifier">assert</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">off</span><span> </span><span class="hs-operator">&gt;=</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span> </span><span class="hs-operator">.</span><span>
</span><span id="line-74"></span><span>     </span><span class="hs-identifier">assert</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">len</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-operator">||</span><span> </span><span class="hs-identifier">c</span><span> </span><span class="hs-operator">&lt;</span><span> </span><span class="hs-number">0xDC00</span><span> </span><span class="hs-operator">||</span><span> </span><span class="hs-identifier">c</span><span> </span><span class="hs-operator">&gt;</span><span> </span><span class="hs-number">0xDFFF</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span class="hs-cpp">
#endif
</span><span>     </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-var">Text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679105111"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679105110"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679105109"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-77"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#text_"><span class="hs-pragma hs-type">text_</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-78"></span><span>
</span><span id="line-79"></span><span class="hs-comment">-- | /O(1)/ The empty 'Text'.</span><span>
</span><span id="line-80"></span><span class="annot"><a href="Data.Text.Internal.html#empty"><span class="hs-identifier hs-type">empty</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-81"></span><span id="empty"><span class="annot"><span class="annottext">empty :: Text
</span><a href="Data.Text.Internal.html#empty"><span class="hs-identifier hs-var hs-var">empty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-var">Text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="Data.Text.Array.html#empty"><span class="hs-identifier hs-var">A.empty</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-82"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#empty"><span class="hs-pragma hs-type">empty</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-83"></span><span>
</span><span id="line-84"></span><span class="hs-comment">-- | A non-inlined version of 'empty'.</span><span>
</span><span id="line-85"></span><span class="annot"><a href="Data.Text.Internal.html#empty_"><span class="hs-identifier hs-type">empty_</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-86"></span><span id="empty_"><span class="annot"><span class="annottext">empty_ :: Text
</span><a href="Data.Text.Internal.html#empty_"><span class="hs-identifier hs-var hs-var">empty_</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-var">Text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="Data.Text.Array.html#empty"><span class="hs-identifier hs-var">A.empty</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-87"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#empty_"><span class="hs-pragma hs-type">empty_</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-88"></span><span>
</span><span id="line-89"></span><span class="hs-comment">-- | Construct a 'Text' without invisibly pinning its byte array in</span><span>
</span><span id="line-90"></span><span class="hs-comment">-- memory if its length has dwindled to zero.</span><span>
</span><span id="line-91"></span><span class="annot"><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-type">text</span></a></span><span> </span><span class="hs-glyph">::</span><span class="hs-cpp">
#if defined(ASSERTS)
</span><span>  </span><span class="hs-identifier">HasCallStack</span><span> </span><span class="hs-glyph">=&gt;</span><span class="hs-cpp">
#endif
</span><span>  </span><span class="annot"><a href="Data.Text.Array.html#Array"><span class="hs-identifier hs-type">A.Array</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-96"></span><span id="text"><span class="annot"><span class="annottext">text :: Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var hs-var">text</span></a></span></span><span> </span><span id="local-6989586621679105107"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679105107"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679105106"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679105106"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679105105"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679105105"><span class="hs-identifier hs-var">len</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679105105"><span class="hs-identifier hs-var">len</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="Data.Text.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-97"></span><span>                 </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text_"><span class="hs-identifier hs-var">text_</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679105107"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679105106"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679105105"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-98"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#text"><span class="hs-pragma hs-type">text</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-99"></span><span>
</span><span id="line-100"></span><span class="annot"><a href="Data.Text.Internal.html#textP"><span class="hs-identifier hs-type">textP</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Array.html#Array"><span class="hs-identifier hs-type">A.Array</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-101"></span><span class="hs-pragma">{-# DEPRECATED</span><span> </span><span class="hs-pragma">textP</span><span> </span><span class="hs-pragma">&quot;Use text instead&quot;</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-102"></span><span id="textP"><span class="annot"><span class="annottext">textP :: Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#textP"><span class="hs-identifier hs-var hs-var">textP</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var">text</span></a></span><span>
</span><span id="line-103"></span><span>
</span><span id="line-104"></span><span class="hs-comment">-- | A useful 'show'-like function for debugging purposes.</span><span>
</span><span id="line-105"></span><span class="annot"><a href="Data.Text.Internal.html#showText"><span class="hs-identifier hs-type">showText</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-106"></span><span id="showText"><span class="annot"><span class="annottext">showText :: Text -&gt; String
</span><a href="Data.Text.Internal.html#showText"><span class="hs-identifier hs-var hs-var">showText</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679105104"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679105104"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679105103"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679105103"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679105102"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679105102"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-107"></span><span>    </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Text &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[Word16] -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; [Word16]
</span><a href="Data.Text.Array.html#toList"><span class="hs-identifier hs-var">A.toList</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679105104"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679105103"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679105102"><span class="hs-identifier hs-var">len</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">' '</span></span><span> </span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span>
</span><span id="line-108"></span><span>            </span><span class="annot"><span class="annottext">Int -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679105103"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">' '</span></span><span> </span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679105102"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-109"></span><span>
</span><span id="line-110"></span><span class="hs-comment">-- | Map a 'Char' to a 'Text'-safe value.</span><span>
</span><span id="line-111"></span><span class="hs-comment">--</span><span>
</span><span id="line-112"></span><span class="hs-comment">-- UTF-16 surrogate code points are not included in the set of Unicode</span><span>
</span><span id="line-113"></span><span class="hs-comment">-- scalar values, but are unfortunately admitted as valid 'Char'</span><span>
</span><span id="line-114"></span><span class="hs-comment">-- values by Haskell.  They cannot be represented in a 'Text'.  This</span><span>
</span><span id="line-115"></span><span class="hs-comment">-- function remaps those code points to the Unicode replacement</span><span>
</span><span id="line-116"></span><span class="hs-comment">-- character (U+FFFD, \'&amp;#xfffd;\'), and leaves other code points</span><span>
</span><span id="line-117"></span><span class="hs-comment">-- unchanged.</span><span>
</span><span id="line-118"></span><span class="annot"><a href="Data.Text.Internal.html#safe"><span class="hs-keyword hs-type">safe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-119"></span><span id="safe"><span class="annot"><span class="annottext">safe :: Char -&gt; Char
</span><a href="Data.Text.Internal.html#safe"><span class="hs-keyword hs-var hs-var">safe</span></a></span></span><span> </span><span id="local-6989586621679105099"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679105099"><span class="hs-identifier hs-var">c</span></a></span></span><span>
</span><span id="line-120"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Int
</span><a href="Data.Text.Internal.Unsafe.Char.html#ord"><span class="hs-identifier hs-var">ord</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679105099"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Bits a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/Data.Bits.html#.%26."><span class="hs-operator hs-var">.&amp;.</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0x1ff800</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-operator hs-var">/=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0xd800</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679105099"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-121"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\xfffd'</span></span><span>
</span><span id="line-122"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#safe"><span class="hs-pragma hs-type">safe</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-123"></span><span>
</span><span id="line-124"></span><span class="hs-comment">-- | Apply a function to the first element of an optional pair.</span><span>
</span><span id="line-125"></span><span id="local-6989586621679105209"><span id="local-6989586621679105210"><span id="local-6989586621679105211"><span class="annot"><a href="Data.Text.Internal.html#firstf"><span class="hs-identifier hs-type">firstf</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679105211"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679105210"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679105211"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679105209"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679105210"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679105209"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-126"></span><span id="firstf"><span class="annot"><span class="annottext">firstf :: forall a c b. (a -&gt; c) -&gt; Maybe (a, b) -&gt; Maybe (c, b)
</span><a href="Data.Text.Internal.html#firstf"><span class="hs-identifier hs-var hs-var">firstf</span></a></span></span><span> </span><span id="local-6989586621679105096"><span class="annot"><span class="annottext">a -&gt; c
</span><a href="#local-6989586621679105096"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679105095"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679105095"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679105094"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679105094"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(c, b) -&gt; Maybe (c, b)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; c
</span><a href="#local-6989586621679105096"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679105095"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679105094"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-127"></span><span class="annot"><a href="Data.Text.Internal.html#firstf"><span class="hs-identifier hs-var">firstf</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; c
</span><span class="hs-identifier">_</span></span><span>  </span><span class="annot"><span class="annottext">Maybe (a, b)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (c, b)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-128"></span><span>
</span><span id="line-129"></span><span class="hs-comment">-- | Checked multiplication.  Calls 'error' if the result would</span><span>
</span><span id="line-130"></span><span class="hs-comment">-- overflow.</span><span>
</span><span id="line-131"></span><span class="annot"><a href="Data.Text.Internal.html#mul"><span class="hs-identifier hs-type">mul</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-132"></span><span id="mul"><span class="annot"><span class="annottext">mul :: Int -&gt; Int -&gt; Int
</span><a href="Data.Text.Internal.html#mul"><span class="hs-identifier hs-var hs-var">mul</span></a></span></span><span> </span><span id="local-6989586621679105093"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679105093"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679105092"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679105092"><span class="hs-identifier hs-var">b</span></a></span></span><span>
</span><span id="line-133"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Word -&gt; Int
forall b. FiniteBits b =&gt; b -&gt; Int
</span><a href="../../base/src/Data.Bits.html#finiteBitSize"><span class="hs-identifier hs-var">finiteBitSize</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Word"><span class="hs-identifier hs-type">Word</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">64</span></span><span>
</span><span id="line-134"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int
</span><a href="Data.Text.Internal.html#int64ToInt"><span class="hs-identifier hs-var">int64ToInt</span></a></span><span> </span><span class="annot"><span class="annottext">(Int64 -&gt; Int) -&gt; Int64 -&gt; Int
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int64
</span><a href="Data.Text.Internal.html#intToInt64"><span class="hs-identifier hs-var">intToInt64</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679105093"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Int64
</span><a href="Data.Text.Internal.html#mul64"><span class="hs-operator hs-var">`mul64`</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int64
</span><a href="Data.Text.Internal.html#intToInt64"><span class="hs-identifier hs-var">intToInt64</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679105092"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-135"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-136"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int32 -&gt; Int
</span><a href="Data.Text.Internal.html#int32ToInt"><span class="hs-identifier hs-var">int32ToInt</span></a></span><span> </span><span class="annot"><span class="annottext">(Int32 -&gt; Int) -&gt; Int32 -&gt; Int
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int32
</span><a href="Data.Text.Internal.html#intToInt32"><span class="hs-identifier hs-var">intToInt32</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679105093"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Int32 -&gt; Int32 -&gt; Int32
</span><a href="Data.Text.Internal.html#mul32"><span class="hs-operator hs-var">`mul32`</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int32
</span><a href="Data.Text.Internal.html#intToInt32"><span class="hs-identifier hs-var">intToInt32</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679105092"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-137"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#mul"><span class="hs-pragma hs-type">mul</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-138"></span><span class="hs-keyword">infixl</span><span> </span><span class="hs-number">7</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#mul"><span class="hs-operator hs-type">`mul`</span></a></span><span>
</span><span id="line-139"></span><span>
</span><span id="line-140"></span><span class="hs-comment">-- | Checked multiplication.  Calls 'error' if the result would</span><span>
</span><span id="line-141"></span><span class="hs-comment">-- overflow.</span><span>
</span><span id="line-142"></span><span class="annot"><a href="Data.Text.Internal.html#mul64"><span class="hs-identifier hs-type">mul64</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span>
</span><span id="line-143"></span><span id="mul64"><span class="annot"><span class="annottext">mul64 :: Int64 -&gt; Int64 -&gt; Int64
</span><a href="Data.Text.Internal.html#mul64"><span class="hs-identifier hs-var hs-var">mul64</span></a></span></span><span> </span><span id="local-6989586621679105086"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105086"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679105085"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105085"><span class="hs-identifier hs-var">b</span></a></span></span><span>
</span><span id="line-144"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105086"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105085"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Int64
</span><a href="Data.Text.Internal.html#mul64_"><span class="hs-identifier hs-var">mul64_</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105086"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105085"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-145"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105086"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">0</span></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Int64
</span><a href="Data.Text.Internal.html#mul64_"><span class="hs-identifier hs-var">mul64_</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105086"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105085"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-146"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105085"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">0</span></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Int64
</span><a href="Data.Text.Internal.html#mul64_"><span class="hs-identifier hs-var">mul64_</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105086"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105085"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-147"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Int64
</span><a href="Data.Text.Internal.html#mul64_"><span class="hs-identifier hs-var">mul64_</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105086"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105085"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-148"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#mul64"><span class="hs-pragma hs-type">mul64</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-149"></span><span class="hs-keyword">infixl</span><span> </span><span class="hs-number">7</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#mul64"><span class="hs-operator hs-type">`mul64`</span></a></span><span>
</span><span id="line-150"></span><span>
</span><span id="line-151"></span><span class="annot"><a href="Data.Text.Internal.html#mul64_"><span class="hs-identifier hs-type">mul64_</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span>
</span><span id="line-152"></span><span id="mul64_"><span class="annot"><span class="annottext">mul64_ :: Int64 -&gt; Int64 -&gt; Int64
</span><a href="Data.Text.Internal.html#mul64_"><span class="hs-identifier hs-var hs-var">mul64_</span></a></span></span><span> </span><span id="local-6989586621679105082"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105082"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679105081"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105081"><span class="hs-identifier hs-var">b</span></a></span></span><span>
</span><span id="line-153"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105080"><span class="hs-identifier hs-var">ahi</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E"><span class="hs-operator hs-var">&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105078"><span class="hs-identifier hs-var">bhi</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E"><span class="hs-operator hs-var">&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Int64
forall a. HasCallStack =&gt; String -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;overflow&quot;</span></span><span>
</span><span id="line-154"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105076"><span class="hs-identifier hs-var">top</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E"><span class="hs-operator hs-var">&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">0x7fffffff</span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Int64
forall a. HasCallStack =&gt; String -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;overflow&quot;</span></span><span>
</span><span id="line-155"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105075"><span class="hs-identifier hs-var">total</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">0</span></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Int64
forall a. HasCallStack =&gt; String -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;overflow&quot;</span></span><span>
</span><span id="line-156"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105075"><span class="hs-identifier hs-var">total</span></a></span><span>
</span><span id="line-157"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(#</span><span> </span><span id="local-6989586621679105080"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105080"><span class="hs-identifier hs-var">ahi</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679105069"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105069"><span class="hs-identifier hs-var">alo</span></a></span></span><span> </span><span class="hs-special">#)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(#</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105082"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int -&gt; Int64
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="../../base/src/Data.Bits.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">32</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105082"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Int64
forall a. Bits a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/Data.Bits.html#.%26."><span class="hs-operator hs-var">.&amp;.</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">0xffffffff</span></span><span> </span><span class="hs-special">#)</span><span>
</span><span id="line-158"></span><span>        </span><span class="hs-special">(#</span><span> </span><span id="local-6989586621679105078"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105078"><span class="hs-identifier hs-var">bhi</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679105064"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105064"><span class="hs-identifier hs-var">blo</span></a></span></span><span> </span><span class="hs-special">#)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(#</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105081"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int -&gt; Int64
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="../../base/src/Data.Bits.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">32</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105081"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Int64
forall a. Bits a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/Data.Bits.html#.%26."><span class="hs-operator hs-var">.&amp;.</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">0xffffffff</span></span><span> </span><span class="hs-special">#)</span><span>
</span><span id="line-159"></span><span>        </span><span id="local-6989586621679105076"><span class="annot"><span class="annottext">top :: Int64
</span><a href="#local-6989586621679105076"><span class="hs-identifier hs-var hs-var">top</span></a></span></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105080"><span class="hs-identifier hs-var">ahi</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Int64
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105064"><span class="hs-identifier hs-var">blo</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Int64
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105069"><span class="hs-identifier hs-var">alo</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Int64
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105078"><span class="hs-identifier hs-var">bhi</span></a></span><span>
</span><span id="line-160"></span><span>        </span><span id="local-6989586621679105075"><span class="annot"><span class="annottext">total :: Int64
</span><a href="#local-6989586621679105075"><span class="hs-identifier hs-var hs-var">total</span></a></span></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105076"><span class="hs-identifier hs-var">top</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int -&gt; Int64
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="../../base/src/Data.Bits.html#shiftL"><span class="hs-operator hs-var">`shiftL`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">32</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Int64
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105069"><span class="hs-identifier hs-var">alo</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Int64
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105064"><span class="hs-identifier hs-var">blo</span></a></span><span>
</span><span id="line-161"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#mul64_"><span class="hs-pragma hs-type">mul64_</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-162"></span><span>
</span><span id="line-163"></span><span class="hs-comment">-- | Checked multiplication.  Calls 'error' if the result would</span><span>
</span><span id="line-164"></span><span class="hs-comment">-- overflow.</span><span>
</span><span id="line-165"></span><span class="annot"><a href="Data.Text.Internal.html#mul32"><span class="hs-identifier hs-type">mul32</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int32"><span class="hs-identifier hs-type">Int32</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int32"><span class="hs-identifier hs-type">Int32</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int32"><span class="hs-identifier hs-type">Int32</span></a></span><span>
</span><span id="line-166"></span><span id="mul32"><span class="annot"><span class="annottext">mul32 :: Int32 -&gt; Int32 -&gt; Int32
</span><a href="Data.Text.Internal.html#mul32"><span class="hs-identifier hs-var hs-var">mul32</span></a></span></span><span> </span><span id="local-6989586621679105054"><span class="annot"><span class="annottext">Int32
</span><a href="#local-6989586621679105054"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679105053"><span class="annot"><span class="annottext">Int32
</span><a href="#local-6989586621679105053"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Int32 -&gt; Int64
</span><a href="Data.Text.Internal.html#int32ToInt64"><span class="hs-identifier hs-var">int32ToInt64</span></a></span><span> </span><span class="annot"><span class="annottext">Int32
</span><a href="#local-6989586621679105054"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Int64
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">Int32 -&gt; Int64
</span><a href="Data.Text.Internal.html#int32ToInt64"><span class="hs-identifier hs-var">int32ToInt64</span></a></span><span> </span><span class="annot"><span class="annottext">Int32
</span><a href="#local-6989586621679105053"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-167"></span><span>              </span><span id="local-6989586621679105051"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105051"><span class="hs-identifier hs-var">ab</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105051"><span class="hs-identifier hs-var">ab</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105050"><span class="hs-identifier hs-var">min32</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%7C%7C"><span class="hs-operator hs-var">||</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105051"><span class="hs-identifier hs-var">ab</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E"><span class="hs-operator hs-var">&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105048"><span class="hs-identifier hs-var">max32</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; Int32
forall a. HasCallStack =&gt; String -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;overflow&quot;</span></span><span>
</span><span id="line-168"></span><span>                 </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int32
</span><a href="Data.Text.Internal.html#int64ToInt32"><span class="hs-identifier hs-var">int64ToInt32</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679105051"><span class="hs-identifier hs-var">ab</span></a></span><span>
</span><span id="line-169"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679105050"><span class="annot"><span class="annottext">min32 :: Int64
</span><a href="#local-6989586621679105050"><span class="hs-identifier hs-var hs-var">min32</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">0x80000000</span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span>
</span><span id="line-170"></span><span>        </span><span id="local-6989586621679105048"><span class="annot"><span class="annottext">max32 :: Int64
</span><a href="#local-6989586621679105048"><span class="hs-identifier hs-var hs-var">max32</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">0x7fffffff</span></span><span>
</span><span id="line-171"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#mul32"><span class="hs-pragma hs-type">mul32</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-172"></span><span class="hs-keyword">infixl</span><span> </span><span class="hs-number">7</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#mul32"><span class="hs-operator hs-type">`mul32`</span></a></span><span>
</span><span id="line-173"></span><span>
</span><span id="line-174"></span><span class="annot"><a href="Data.Text.Internal.html#intToInt64"><span class="hs-identifier hs-type">intToInt64</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span>
</span><span id="line-175"></span><span id="intToInt64"><span class="annot"><span class="annottext">intToInt64 :: Int -&gt; Int64
</span><a href="Data.Text.Internal.html#intToInt64"><span class="hs-identifier hs-var hs-var">intToInt64</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int64
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span>
</span><span id="line-176"></span><span>
</span><span id="line-177"></span><span class="annot"><a href="Data.Text.Internal.html#int64ToInt"><span class="hs-identifier hs-type">int64ToInt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-178"></span><span id="int64ToInt"><span class="annot"><span class="annottext">int64ToInt :: Int64 -&gt; Int
</span><a href="Data.Text.Internal.html#int64ToInt"><span class="hs-identifier hs-var hs-var">int64ToInt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span>
</span><span id="line-179"></span><span>
</span><span id="line-180"></span><span class="annot"><a href="Data.Text.Internal.html#intToInt32"><span class="hs-identifier hs-type">intToInt32</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int32"><span class="hs-identifier hs-type">Int32</span></a></span><span>
</span><span id="line-181"></span><span id="intToInt32"><span class="annot"><span class="annottext">intToInt32 :: Int -&gt; Int32
</span><a href="Data.Text.Internal.html#intToInt32"><span class="hs-identifier hs-var hs-var">intToInt32</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int32
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span>
</span><span id="line-182"></span><span>
</span><span id="line-183"></span><span class="annot"><a href="Data.Text.Internal.html#int32ToInt"><span class="hs-identifier hs-type">int32ToInt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int32"><span class="hs-identifier hs-type">Int32</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-184"></span><span id="int32ToInt"><span class="annot"><span class="annottext">int32ToInt :: Int32 -&gt; Int
</span><a href="Data.Text.Internal.html#int32ToInt"><span class="hs-identifier hs-var hs-var">int32ToInt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int32 -&gt; Int
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span>
</span><span id="line-185"></span><span>
</span><span id="line-186"></span><span class="annot"><a href="Data.Text.Internal.html#int32ToInt64"><span class="hs-identifier hs-type">int32ToInt64</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int32"><span class="hs-identifier hs-type">Int32</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span>
</span><span id="line-187"></span><span id="int32ToInt64"><span class="annot"><span class="annottext">int32ToInt64 :: Int32 -&gt; Int64
</span><a href="Data.Text.Internal.html#int32ToInt64"><span class="hs-identifier hs-var hs-var">int32ToInt64</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int32 -&gt; Int64
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span>
</span><span id="line-188"></span><span>
</span><span id="line-189"></span><span class="annot"><a href="Data.Text.Internal.html#int64ToInt32"><span class="hs-identifier hs-type">int64ToInt32</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int32"><span class="hs-identifier hs-type">Int32</span></a></span><span>
</span><span id="line-190"></span><span id="int64ToInt32"><span class="annot"><span class="annottext">int64ToInt32 :: Int64 -&gt; Int32
</span><a href="Data.Text.Internal.html#int64ToInt32"><span class="hs-identifier hs-var hs-var">int64ToInt32</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int32
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span>
</span><span id="line-191"></span><span>
</span><span id="line-192"></span><span class="hs-comment">-- $internals</span><span>
</span><span id="line-193"></span><span class="hs-comment">--</span><span>
</span><span id="line-194"></span><span class="hs-comment">-- Internally, the 'Text' type is represented as an array of 'Word16'</span><span>
</span><span id="line-195"></span><span class="hs-comment">-- UTF-16 code units. The offset and length fields in the constructor</span><span>
</span><span id="line-196"></span><span class="hs-comment">-- are in these units, /not/ units of 'Char'.</span><span>
</span><span id="line-197"></span><span class="hs-comment">--</span><span>
</span><span id="line-198"></span><span class="hs-comment">-- Invariants that all functions must maintain:</span><span>
</span><span id="line-199"></span><span class="hs-comment">--</span><span>
</span><span id="line-200"></span><span class="hs-comment">-- * Since the 'Text' type uses UTF-16 internally, it cannot represent</span><span>
</span><span id="line-201"></span><span class="hs-comment">--   characters in the reserved surrogate code point range U+D800 to</span><span>
</span><span id="line-202"></span><span class="hs-comment">--   U+DFFF. To maintain this invariant, the 'safe' function maps</span><span>
</span><span id="line-203"></span><span class="hs-comment">--   'Char' values in this range to the replacement character (U+FFFD,</span><span>
</span><span id="line-204"></span><span class="hs-comment">--   \'&amp;#xfffd;\').</span><span>
</span><span id="line-205"></span><span class="hs-comment">--</span><span>
</span><span id="line-206"></span><span class="hs-comment">-- * A leading (or \&quot;high\&quot;) surrogate code unit (0xD800&#8211;0xDBFF) must</span><span>
</span><span id="line-207"></span><span class="hs-comment">--   always be followed by a trailing (or \&quot;low\&quot;) surrogate code unit</span><span>
</span><span id="line-208"></span><span class="hs-comment">--   (0xDC00-0xDFFF). A trailing surrogate code unit must always be</span><span>
</span><span id="line-209"></span><span class="hs-comment">--   preceded by a leading surrogate code unit.</span><span>
</span><span id="line-210"></span></pre></body></html>